<?php

namespace app\admin\model\user;

use app\common\model\TimeModel;

class UserBill extends TimeModel
{

    protected $name = "user_bill";

    protected $deleteTime = false;

    /**
     * Author:Yingbo Sun
     * 收入记录
     * @param $title
     * @param $uid
     * @param $number
     * @param int $status
     * @return UserBill|\think\Model
     */
    public static function income($title, $uid, $number,$category = '',$type = '',$mark = '', $is_status = 0)
    {
        $pm = 1;
        return self::create(compact('title', 'uid', 'number', 'is_status','mark','pm','category','type'));
    }

    /**
     * Author:Yingbo Sun
     * 支出记录
     * @param $title
     * @param $uid
     * @param $number
     * @param int $status
     * @return UserBill|\think\Model
     */
    public static function expend($title, $uid, $number,$category = '',$type = '',$mark = '', $status = 0)
    {
        $pm = 0;
        return self::create(compact('title', 'uid','category','type','number','mark', 'status', 'pm'));
    }

    public function userBill()
    {
        return $this->belongsTo(User::class,'uid','id');
    }



}